package com.example.feign.user;

import com.example.common.api.ResultUtil;
import com.example.feign.user.fallback.GoodsFeignFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@FeignClient(value = "demo-goods", path = "/api", fallback = GoodsFeignFallback.class, decode404 = true)  //value中是调用服务的名称，这个要对应服务名称
public interface GoodsFeignClient {

    @GetMapping(value = "/goods/get_goods_by_id", produces = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    ResultUtil getGoodsById(@RequestParam(required = false, name = "id") Long id);
}
